﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:SF_Comp="clr-namespace:ScrumFactory.Composition;assembly=ScrumFactory.Composition" 
    xmlns:SF_Adorners="clr-namespace:ScrumFactory.Windows.Helpers.Adorners;assembly=ScrumFactory.Windows.Helpers"             
    xmlns:props="clr-namespace:ScrumFactory.Team.Properties"
    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
    xmlns:SF_Converters="clr-namespace:ScrumFactory.Windows.Helpers.Converters;assembly=ScrumFactory.Windows.Helpers"
    xmlns:SF="clr-namespace:ScrumFactory;assembly=ScrumFactory"
    xmlns:Team_Converters="clr-namespace:ScrumFactory.Team.Converters"
     xmlns:SF_Helpers="clr-namespace:ScrumFactory.Windows.Helpers;assembly=ScrumFactory.Windows.Helpers">

    <Team_Converters:NewTrophyConverter x:Key="NewTrophyConverter" />

    <Style x:Key="PerformanceBoard" TargetType="ContentControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <StackPanel>
                        <Image Source="/Images/TaskTypes/bug.png"  Margin="6,16,6,6"  Width="22" Height="22"></Image>
                        <TextBlock Padding="0,0,0,10" TextWrapping="Wrap" HorizontalAlignment="Center" Text="{Binding MemberProfile.Performance.BugsResolved, StringFormat={x:Static props:Resources.Bugs_Resolved}}" TextAlignment="Center"/>

                        <Image Source="/Images/TaskTypes/improvement.png" Margin="6"   Width="22" Height="22"></Image>
                        <TextBlock Padding="0,0,0,10" TextWrapping="Wrap" HorizontalAlignment="Center"  Text="{Binding MemberProfile.Performance.ImprovimentsDone, StringFormat={x:Static props:Resources.Improvements_Done}}" TextAlignment="Center"/>


                        <Image Source="/Images/TaskTypes/postIt.png" Margin="6" Width="22" Height="22"></Image>
                        <TextBlock Padding="0,0,0,10" TextWrapping="Wrap" HorizontalAlignment="Center" Text="{Binding MemberProfile.Performance.TasksDone, StringFormat={x:Static props:Resources.NormalTasks_Done}}" />
                        <TextBlock  Padding="0,0,0,20" TextWrapping="Wrap" HorizontalAlignment="Center" TextAlignment="Center"
                                                Text="{Binding MemberProfile.Performance.TotalWorkedHours, StringFormat={x:Static props:Resources.Worked_hours}}" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TrophyImage" TargetType="Image" >
        <Setter Property="Source" Value="{Binding ., Converter={StaticResource ImageSourceConverter}, ConverterParameter='/Images/trophy/{0}.png'}"/>
        <Setter Property="Margin" Value="0,0,10,0"/>
        <Setter Property="Width" Value="42"/>
        <Setter Property="Height" Value="42"/>
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect Opacity="0.3"/>
            </Setter.Value>
        </Setter>
        <Setter Property="ToolTipService.Placement" Value="Left"/>
        <Setter Property="ToolTip">
            <Setter.Value>
                <TextBlock Width="150">
                    <TextBlock Text="{Binding ., Converter={StaticResource LocalizeConverter}}" FontWeight="Bold" TextWrapping="Wrap"/><LineBreak/>
                    <TextBlock Text="{Binding ., Converter={StaticResource LocalizeWithTooltipConverter}}" TextWrapping="Wrap"/>                
                </TextBlock>
            </Setter.Value>
        </Setter>             
    </Style>

    <Style x:Key="SignedMemberTrophyImage" TargetType="Image" BasedOn="{StaticResource TrophyImage}" >       
        <Setter Property="RenderTransform">
            <Setter.Value>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding ., Converter={StaticResource NewTrophyConverter}}" Value="True">
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation 
                                From="10" To="1" Duration="0:0:0.3"
                                AutoReverse="False" Storyboard.TargetProperty="(Image.RenderTransform).(ScaleTransform.ScaleX)"/>
                            <DoubleAnimation 
                                From="10" To="1" Duration="0:0:0.3"
                                AutoReverse="False" Storyboard.TargetProperty="(Image.RenderTransform).(ScaleTransform.ScaleY)"/>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
            </DataTrigger>
        </Style.Triggers>
    </Style>


    <DataTemplate x:Key="PostItDataTemplate">
        <SF_Helpers:PixelBorder  Style="{StaticResource PostItBorderNoVM}"
                            Margin="0,2,8,10" 
                            Width="100" Height="100" VerticalAlignment="Top" Cursor="Hand"
                            x:Name="itemBorder"
                            ToolTipService.Placement="Top" ToolTipService.InitialShowDelay="2000" ToolTipService.BetweenShowDelay="2000"
                            BorderThickness="2" CornerRadius="0">
            <Button Style="{StaticResource CleanButton}"
                    Command="{Binding Model.ShowTaskDetailCommand, ElementName=thisView}"
                    CommandParameter="{Binding ElementName=itemBorder, Path=DataContext}">
                <TextBlock 
                        FontSize="{StaticResource SmallFontSize}" Foreground="Black"
                        Margin="5,0,0,0" TextTrimming="CharacterEllipsis" TextWrapping="Wrap" Text="{Binding TaskName}"/>
            </Button>
            <SF_Helpers:PixelBorder.ToolTip>
                <TextBlock >
                    <TextBlock Text="{Binding TaskInfo.ProjectName, Mode=OneWay}" TextWrapping="NoWrap"/><LineBreak/>
                    <TextBlock Text="{Binding HoursLeft, Mode=OneWay, StringFormat={x:Static props:Resources.N_hours_of_work}}" TextWrapping="NoWrap"/><LineBreak/>
                    <TextBlock Text="{Binding DaysOpened, Mode=OneWay, StringFormat={x:Static props:Resources.N_days}}" TextWrapping="NoWrap"/>
                </TextBlock>

            </SF_Helpers:PixelBorder.ToolTip>
        </SF_Helpers:PixelBorder>
    </DataTemplate>

  

    <Style x:Key="EventDescriptionTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Margin" Value="0,4,0,4"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding EventType}" Value="0">
                <Setter Property="TextBlock.Text" Value="{Binding ProjectName, StringFormat={x:Static props:Resources.to_start_project_N}}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding EventType}" Value="1">
                <Setter Property="TextBlock.Text" Value="{Binding ProjectName, StringFormat={x:Static props:Resources.to_start_sprint_N}}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding EventType}" Value="2">
                <Setter Property="TextBlock.Text" Value="{Binding ProjectName, StringFormat={x:Static props:Resources.to_end_project_N}}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="NoItemsTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
        <Setter Property="Text" Value="{x:Static props:Resources.no_items}"/>
        <Setter Property="Foreground" Value="{StaticResource SubTextBrush}"/>
        <Setter Property="TextBlock.Visibility" Value="Collapsed"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding .}" Value="0">
                <Setter Property="TextBlock.Visibility" Value="Visible"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="MemberTasksListBox" TargetType="ItemsControl">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate" Value="{StaticResource PostItDataTemplate}"/>
    </Style>

    <Style x:Key="MoreTasksButton" TargetType="Button">        
        <Setter Property="Command" Value="{Binding Model.ShowMemberDetailCommand, ElementName=thisView}"/>
        <Setter Property="CommandParameter" Value="{Binding .}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border Background="{StaticResource TitleTextBrush}" Height="18" VerticalAlignment="Bottom" ClipToBounds="True" Margin="0,0,2,0">
                        <TextBlock                                                 
                        Foreground="White"
                        FontSize="28" Margin="1,0,1,0" VerticalAlignment="Bottom"
                        Text="..." ToolTip="{x:Static props:Resources.and_more}"/>
                        <Border.Style>
                            <Style TargetType="Border">
                                <Setter Property="Cursor" Value="Hand"/>                                
                                <Setter Property="Visibility" Value="Collapsed"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding MemberUId}" Value="{x:Null}">
                                        <Setter Property="Cursor" Value="Arrow"/>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding OpenTasks.Count}" Value="5">
                                        <Setter Property="Visibility" Value="Visible"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Border.Style>
                    </Border>
                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding MemberUId}" Value="{x:Null}">
                <Setter Property="Visibility" Value="Collapsed"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    
    <Style x:Key="MemberTeamTasksListBox" TargetType="ItemsControl">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Padding" Value="0"/>
        
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid Margin="8,0,16,8" MinWidth="250">
                            
                            <Grid.Background>
                                <VisualBrush Stretch="None" AlignmentX="Left" AlignmentY="Top" TileMode="None" >
                                    <VisualBrush.Visual>
                                    <StackPanel Orientation="Horizontal">
                                        <Border Background="Transparent" Width="60"/>
                                        <TextBlock Text="{Binding FullName}" FontSize="36" Style="{StaticResource CoverTextTitle}" />
                                    </StackPanel>
                                        
                                    </VisualBrush.Visual>
                                </VisualBrush>
                            </Grid.Background>

                        <Button Style="{StaticResource OverButton}" HorizontalAlignment="Left" VerticalAlignment="Top"
                                Command="{Binding Model.ShowMemberDetailCommand, ElementName=thisView}"
                                CommandParameter="{Binding .}">
                            <ContentControl Style="{StaticResource MemberImageControlStyle}" DataContext="{Binding .}" Margin="3"/>
                        </Button>



                            <StackPanel Orientation="Horizontal" Margin="0,55,0,0">
                                <ItemsControl
                                    VerticalAlignment="Center" 
                                    ItemsSource="{Binding Model.MemberEngagedProjects, ElementName=thisView}">
                                    <ItemsControl.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Horizontal" />
                                        </ItemsPanelTemplate>
                                    </ItemsControl.ItemsPanel>
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <Button Style="{StaticResource OverButton}" Command="{Binding Model.ShowProjectDetailCommand, ElementName=thisView}" CommandParameter="{Binding ProjectUId}"
                                                    Height="100">
                                            <StackPanel Margin="0,0,5,0" Width="100" VerticalAlignment="Center" >
                                                <Image                                                                        
                                                        DataContext="{Binding Status,Converter={StaticResource EnumToShortConverter}, ConverterParameter={x:Type SF:ProjectStatus}}"
                                                        Style="{StaticResource ProjectStatusImage}" VerticalAlignment="Center" HorizontalAlignment="Center"/>

                                                <TextBlock Text="{Binding ProjectName}" MaxHeight="60" TextTrimming="CharacterEllipsis"
                                                        TextWrapping="Wrap"  Foreground="White" FontWeight="Bold" 
                                                        HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center"
                                                        FontSize="{StaticResource NormalFontSize}"  />
                                            </StackPanel>
                                        </Button>                                                
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                    <ItemsControl.Style>
                                        <Style TargetType="ItemsControl">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsSignedMember}" Value="True">
                                                    <Setter Property="Visibility" Value="Visible"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </ItemsControl.Style>
                                </ItemsControl>
                                <ItemsControl 
                                    ItemsSource="{Binding OpenTasks}" HorizontalAlignment="Left"
                                    ItemTemplate="{StaticResource PostItDataTemplate}">
                                    <ItemsControl.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <WrapPanel Orientation="Horizontal"/>
                                        </ItemsPanelTemplate>
                                    </ItemsControl.ItemsPanel>
                                    <!--<ItemsControl.Style>
                                        <Style>
                                            <Setter Property="ItemsControl.ItemTemplate" Value="{StaticResource PostItDataTemplate}"/>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsSignedMember}" Value="True">
                                                    <Setter Property="ItemsControl.ItemTemplate" Value="{StaticResource PostItSingnedMemberDataTemplate}"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </ItemsControl.Style>-->
                                </ItemsControl>
                            <Border Margin="0,0,0,0" Width="100" Height="100" BorderThickness="2" CornerRadius="0" BorderBrush="{StaticResource CoverAreaBrush}" HorizontalAlignment="Left">
                                <TextBlock 
                                    Foreground="{StaticResource CoverAreaBrush}" TextWrapping="Wrap"                                    
                                    Text="{x:Static props:Resources.no_tasks}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                                <Border.Style>
                                    <Style>
                                        <Setter Property="Border.Visibility" Value="Collapsed"/>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding OpenTasks.Count}" Value="0">
                                                <Setter Property="Border.Visibility" Value="Visible"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Border.Style>
                            </Border>
                            <Button Style="{StaticResource MoreTasksButton}"/>
                                <!--<StackPanel.Style>
                                    <Style>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding OpenTasks.Count}" Value="0">
                                                <Setter Property="StackPanel.Visibility" Value="Collapsed"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </StackPanel.Style>-->
                            </StackPanel>
                            
                           
                       




                        </Grid>                                      
                </DataTemplate>
            </Setter.Value>
        </Setter>
       
    </Style>

    <Style x:Key="MemberEngagementListBox" TargetType="ItemsControl">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>        
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">            
            <Setter.Value>                
                <DataTemplate>
                    <Button Style="{StaticResource OverButton}" Margin="0,0,0,5"
                            Command="{Binding Model.ShowProjectDetailCommand, ElementName=thisView}" CommandParameter="{Binding ProjectUId}">
                        <StackPanel Width="100">
                            <Image                    
                            DataContext="{Binding Status,Converter={StaticResource EnumToShortConverter}, ConverterParameter={x:Type SF:ProjectStatus}}"
                            Style="{StaticResource ProjectStatusImage}" VerticalAlignment="Top" HorizontalAlignment="Center"/>
                            <TextBlock Text="{Binding ProjectName}" 
                                   TextWrapping="Wrap" HorizontalAlignment="Center" TextAlignment="Center"
                                   TextTrimming="CharacterEllipsis" FontSize="{StaticResource NormalFontSize}" />
                        </StackPanel>
                    </Button>                        
                </DataTemplate>                
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="MemberWorkingWithListBox" TargetType="ItemsControl">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
            <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal" Width="330" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel Orientation="Vertical" Width="80" Height="80">
                        <ContentControl Style="{StaticResource MemberImageControlStyle}" Width="45" Height="45" DataContext="{Binding MemberProfile}"/>
                        <TextBlock Text="{Binding MemberProfile.FullName}" 
                                                       FontSize="{StaticResource SmallFontSize}" Foreground="Black"
                                                       Margin="0,1,0,0" TextWrapping="Wrap" 
                                                       TextTrimming="CharacterEllipsis"  
                                                        TextAlignment="Center"
                                                       HorizontalAlignment="Center"/>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>